package com.heima.article.web.controller;

import com.heima.article.service.ApArticleService;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.common.dtos.article.ArticleHomeDto;
import com.heima.model.common.wemedia.pojo.WmNews;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/v1/article")
public class ArticleController {

    @Autowired
    private ApArticleService apArticleService;

    @PostMapping("/load")
    public ResponseResult load(@RequestBody ArticleHomeDto dto) {
        return apArticleService.load(dto);
    }

    @PostMapping("/loadmore")
    public ResponseResult loadMore(@RequestBody ArticleHomeDto dto) {
        return apArticleService.load(dto);
    }

    @PostMapping("/loadnew")
    public ResponseResult loadNew(@RequestBody ArticleHomeDto dto) {
        return apArticleService.load(dto);
    }
    @PostMapping("/add")
    public ResponseResult add(@RequestBody WmNews wmNews,@RequestParam("authorName") String authorName,@RequestParam("channelName") String channelName){
       return apArticleService.add(wmNews,authorName,channelName);
    }

}



